<template>
    <el-menu :default-active="$route.path" class="top-nav" mode="horizontal">
      <el-menu-item index="/">
        <router-link to="/">Home</router-link>
      </el-menu-item>
      <el-menu-item index="login">
        <router-link to="/api/login">Login</router-link>
      </el-menu-item>
      <el-menu-item index="crud">
        <router-link to="/crud">CRUD</router-link>
      </el-menu-item>
      <el-menu-item index="test">
        <router-link to="/test">test</router-link>
      </el-menu-item>
      <el-menu-item index="logout">
        <button @click="logout">Logout</button>
      </el-menu-item>
    </el-menu>
</template>
  
<script setup>

import { logout } from '@/js/login.js';
  
</script>

<style scoped>
    .top-nav {
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1000;
        background-color: gray; /* 背景颜色 */
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 阴影效果 */
    }
    button {
        padding: 10px 20px;
        font-size: 16px;
        background-color: #4CAF50;
        color: white;
        border: none;
        cursor: pointer;
    }
</style>